package com.fuhao.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class OrderNum {
	private static Integer count = 0;
	
	public String createOderNum() {
		//为了测试效果，创建订单号设置慢一点
		try {
			TimeUnit.SECONDS.sleep(3);
		} catch (Exception e) {
			// TODO: handle exception
		}
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
		String oderNum = format.format(new Date()) + ++count;
		return oderNum.replace("-", "");
		
	}

	public static void main(String[] args) {
		System.out.println(new OrderNum().createOderNum());
	}
}
